/*
 * Copyright (c) novafaen design 2009
 */
package tentaflykt.editor.xml;

import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;

/**
 * Simple error handler for XML parsing.
 * @author Kristoffer Nilsson
 */
public class SimpleErrorHandler implements ErrorHandler {
  /**
   * Constructor, creates a <code>SimpleErrorHandler</code>.
   */
  public SimpleErrorHandler() {
    // nothing, should log?
  }
  
  /**
   * Handles warnings.
   * @param ex Warning exception
   * @throws SAXException SAX exception
   */
  public void warning(SAXParseException ex) throws SAXException {
    System.out.println(ex.getMessage());
  }

  /**
   * Handles errors.
   * @param ex Error exception
   * @throws SAXException SAX exception
   */
  public void error(SAXParseException ex) throws SAXException {
    throw new SAXException(ex.getMessage());
  }

  /**
   * Handles fatal errors.
   * @param ex Fatal error exception
   * @throws SAXException SAX exception
   */
  public void fatalError(SAXParseException ex) throws SAXException {
    throw new SAXException(ex.getMessage());
  }
}
